﻿using AutoMapper;
using RBAC.Domain.Dto.Output;
using RBAC.Domain.RBAC;
using RBAC.Domain.SmartHealthcare;
using RBAC.Domain.SmartHealthcare.Hosiptial;
using SmartHealthcare.Read.Api.DTo;

namespace SmartHealthcare.Read.Api
{
    public class SmartHealthcareAutoMapper:Profile
    {
        public SmartHealthcareAutoMapper()
        {
            CreateMap<DepartmentModel, DepartmentDto>();
            CreateMap<CaseModel, CaseDto>();

            // 为DepartmentCaseDto创建自定义映射
            CreateMap<DepartmentModel, DepartmentCaseDto>()
                .ForMember(dest => dest.DepartmentId, opt => opt.MapFrom(src => src.Id))
                .ForMember(dest => dest.CaseName, opt => opt.Ignore()); // 病例名称需要单独设置

            // 药房管理映射
            CreateMap<Prescription, PrescriptionDto>();
            CreateMap<MedicineItem, MedicineItemDto>();
            CreateMap<PatientListModel, PatientDto>();
            // 病房和病床映射
            CreateMap<HospitalRoomModel, HospitalRoomDto>();
            CreateMap<HospitalBedModel, HospitalBedDto>();

            // 病人映射
            CreateMap<PatientListModel, PatientListDto>();
            
            // 支付记录映射
            CreateMap<PaymentRecordModel, PaymentRecordDto>();
            
            // 住院费用记录映射
            CreateMap<HospitalExpenseModel, HospitalExpenseDto>();
            
            // 药品映射
            CreateMap<MedicineModel, MedicineStorageDto>();
        }
    }
}
